Test Series - java script

Test Number 28/92

Q: Which function among the following lets to register a function to be invoked once?
A. setTimeout()
B. setTotaltime()
C. setInterval()
D. settime()
Solution: setTimeout() and setInterval() allow you to register a function to be invoked once or repeatedly after a specified amount of time has elapsed. Both these function are used to do time manipulation in javascript.
Q: Which function among the following lets to register a function to be invoked repeatedly after a certain time?
A. setTimeout()
B. setTotaltime()
C. setInterval()
D. settime()
Solution: setTimeout() and setInterval() allow you to register a function to be invoked once or repeatedly after a specified amount of time has elapsed. Both these function are used to do time manipulation in javascript.
Q: Which is the handler method used to invoke when uncaught JavaScript exceptions occur?
A. Onhalt
B. Onerror
C. Both onhalt and onerror
D. Onsuspend
Solution: The onerror handler method can be registered to be invoked when uncaught JavaScript exceptions occur. The onerror event is triggered if an error occurs while loading an external file (e.g. a document or an image).
Q:  Which property is used to obtain browser vendor and version information?
A. modal
B. version
C. browser
D. navigator
Solution: The navigator property is used to obtain browser vendor and version information. Various navaigator property includes appname, appversion, geolocation, language etc.
Q: Which method receives the return value of setInterval() to cancel future invocations?
A. clearInvocation()
B. cancelInvocation()
C. clearInterval()
D. clear()
Solution: Like setTimeout(), setInterval() returns a value that can be passed to clearInterval() to cancel any future invocations of the scheduled function. The ID value returned by setInterval() is used as the parameter for the clearInterval() method.
Q: The setTimeout() belongs to which object?
A. Element
B. Window
C. Location
D. Event
Solution: The setTimeout() method of the Window object schedules a function to run after a specified number of milliseconds elapses. setTimeout() and setInterval() are used for time manipulations in javascript.
Q: Which method receives the return value of setTimeout() to cancel future invocations?
A. clearTimeout()
B. clearInterval()
C. clearSchedule()
D. cancelInvocation()
Solution: setTimeout() returns a value that can be passed to clearTimeout() to cancel the execution of the scheduled function. The ID value returned by setTimeout() is used as the parameter for the clearTimeout() method.
Q: What will happen if we call setTimeout() with a time of 0 ms?
A. Placed in stack
B. Placed in queue
C. Will run continuously
D. Will execute immediately
Solution: If you call setTimeout() with a time of 0 ms, the function you specify is not invoked right away. Instead, it is placed on a queue to be invoked “as soon as possible” after any currently pending event handlers finish running.
Q: To which object does the location property belong?
A. Window
B. Position
C. Element
D. Location
Solution: The location property of the Window object refers to a Location object, which represents the current URL of the document displayed in the window. The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.
Q: What is the result of the following code snippet?

window.location === document.location
A. False
B. True
C. 1
D. 0
Solution: The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page. The Document.location read-only property returns a Location object, which contains information about the URL of the document and provides methods for changing that URL and loading another URL.

You Have Score    /10